package com.easychat.controller;

import com.easychat.annotation.GlobalInterceptor;
import com.easychat.entity.po.UserInfo;
import com.easychat.entity.po.UserInfoBeauty;
import com.easychat.entity.query.UserInfoBeautyQuery;
import com.easychat.entity.query.UserInfoQuery;
import com.easychat.entity.vo.PaginationResultVO;
import com.easychat.entity.vo.ResponseVO;
import com.easychat.service.UserInfoBeautyService;
import com.easychat.service.UserInfoService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * @program: easychat-java
 * @description:
 * @author: Mr.Wang
 * @create: 2024-12-05 12:49
 **/

@RestController("adminUserInfoBeautyController")
@RequestMapping("/admin")
public class AdminUserInfoBeautyController extends ABaseController{


    @Resource
    private UserInfoService userInfoService;
    @Resource
    private UserInfoBeautyService userInfoBeautyService;


    /**
     * 获取靓号列表
     * @param userInfoBeautyQuery
     * @return
     */
    @RequestMapping("/loadBeautyAccountList")
    @GlobalInterceptor(checkAdmin = true)
    public ResponseVO loadBeautyAccountList(UserInfoBeautyQuery userInfoBeautyQuery) {
        return getSuccessResponseVO(userInfoBeautyService.findListByPage(userInfoBeautyQuery));
    }

    /**
     * 添加或修改靓号
     * @param userInfoBeauty
     * @return
     */
    @RequestMapping("/saveBeautyAccount")
    @GlobalInterceptor(checkAdmin = true)
    public ResponseVO saveBeautyAccount(UserInfoBeauty userInfoBeauty) {
        userInfoBeautyService.saveAccount(userInfoBeauty);
        return getSuccessResponseVO(null);
    }


    /**
     * 删除靓号
     * @param id
     * @return
     */
    @RequestMapping("/delBeautyAccount")
    @GlobalInterceptor(checkAdmin = true)
    public ResponseVO delBeautyAccount(@NotNull Integer id) {
        return getSuccessResponseVO(userInfoBeautyService.deleteUserInfoBeautyById(id));
    }


}
